<template>
    <Transition name="xsyModal">
        <div class="common-modal" v-show="modalVisible">
            <div class="modal-wrap">
                <div class="header">
                    <svg-icon class="close-btn" name="icon_close"  @click="handleClose"></svg-icon>
                </div>
                <div class="content">
                    <div v-html="text"></div>
                </div>
                <div class="footer">
                    <a-button @click="modalVisible = false" class="mr-8">取消</a-button>
                    <a-button type="primary" @click="modalVisible = false">确定</a-button>
                </div>
            </div>
        </div>
    </Transition>
</template>
<script setup>
import { defineProps, defineEmits, computed } from 'vue';

const props = defineProps({
    modelValue: {
        type: Boolean,
        default: false
    },
    text: {
        type: String,
        default: ''
    }
});

const emit = defineEmits(['update:modelValue']);
const modalVisible = computed({
    get: () => props.modelValue,
    set: v => emit('update:modelValue', v),
});

const handleClose = () => {
    emit('update:modelValue', false)
}
</script>
<style scoped lang="less">
.down {
    &-enter {
        &-from {
            transform: translate3d(0, -75px, 0);
            // opacity: 0;
        }

        &-active {
            transition: all 0.5s;
        }

        &-to {
            transform: none;
            opacity: 1;
        }
    }
}

.common-modal {
    width: 100%;
    height: 100%;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #999;
    border-radius: 4px;
    
    .modal-wrap {
        display: flex;
        flex-direction: column;
        width: 688px;
        max-height: 80%;
        border-radius: 6px;
        background: linear-gradient(180deg, #E9F3FF 22.74%, #FFF 100%);
        .header {
            position: relative;
            width: 100%;
            height: 140px;
            border-radius: 6px 6px 0 0;
            background: url('@/assets/img/console/modal-bg.png') 100%  no-repeat;

            .close-btn {
                width: 16px;
                height: 16px;
                position: absolute;
                right: 24px;
                top:24px;
                color: #000;
            }
        }

        .content,
        .footer {
            padding: 24px;
            background: #fff;
        }

        .content {
            flex: 1;
            overflow: scroll;
        }
        .footer {
            text-align: right;
        }
    }



}
</style>